package com.zdyt.opc.config;


import org.springframework.boot.context.properties.ConfigurationProperties;


@ConfigurationProperties(prefix = "opc")
public class OpcProperties {

    private String host;   // host

    private String user;   // user or userName

    private String password;  // password

    private String domain;  // domain

    private String progId; // progid

    private String targetUrl; //targetUrl  任务目标发送的接口地址

    private String connectPath;

    private int period; // 采集周期时间  (ms单位)

    private static final int DEFAULT_PERIOD = 10*1000; // 默认10s


    public String getConnectPath() {
        return connectPath;
    }

    public void setConnectPath(String connectPath) {
        this.connectPath = connectPath;
    }

    public String getTargetUrl() {
        return targetUrl;
    }

    public void setTargetUrl(String targetUrl) {
        this.targetUrl = targetUrl;
    }

    public static int getDefaultPeriod() {
        return DEFAULT_PERIOD;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getDomain() {
        if (null == domain){
            return "";
        }
        return domain;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    public String getProgId() {
        return progId;
    }

    public void setProgId(String progId) {
        this.progId = progId;
    }

    public int getPeriod() {
        if (period <= 0){
            return DEFAULT_PERIOD;
        }
        return period;
    }

    public void setPeriod(int period) {
        this.period = period;
    }
}
